<?php

namespace app\index\model;

use think\Db;
use think\Model;

class Comment extends Model
{
    //查询所有数据
    public function sel() {
//        $res = Db::name('comment')->alias('c')->join('user u','c.user_id=u.id')->join('article a','c.article_id=a.id')->field('u.username,title,data')->select();
        $res = Db::name('comment')->alias('c')->join('user','c.user_id=user.id')->join('article a','c.article_id=a.id')->field('c.id,user.username,title,data')->select();
        return $res;
    }

    //删除数据
    public function del($id) {
        $res = self::get($id);
        $res = $res->delete();
        return $res;
    }
}
